package com.lianxian.xindong.home.mvp.ui.adapter;

import android.view.View;

import com.hxb.library.base.BaseHolder;
import com.hxb.library.base.DefaultAdapter;
import com.lianxian.xindong.home.R;
import com.lianxian.xindong.home.mvp.ui.holder.VideoPlayerItemHolder;
import com.lianxian.xindong.home.mvp.ui.weight.douyin.MyVideoPlayer;

import java.util.List;

public class VideoPlayerAdapter extends DefaultAdapter<String> {

    private MyVideoPlayer mVideoPlayer;

    public void setVideoPlayer(MyVideoPlayer videoPlayer) {
        mVideoPlayer = videoPlayer;
    }

    public VideoPlayerAdapter(List<String> infos) {
        super(infos);
    }

    @Override
    public BaseHolder<String> getHolder(View v, int viewType) {
        return new VideoPlayerItemHolder(v);
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_video_player;
    }

    public void onPausePlay() {
        if (mVideoPlayer != null) {
            mVideoPlayer.onPausePlay();
        }
    }

    public void onStartPlay() {
        if (mVideoPlayer != null) {
            mVideoPlayer.onStartPlay();
        }
    }

}
